package com.shop.user.atom.controller;

import com.shop.common.entity.user.UserBase;
import com.shop.common.model.ServiceBean;
import com.shop.common.model.param.user.MessageInput;
import com.shop.common.model.param.user.UserPayInput;
import com.shop.common.model.param.user.UserPayLogInput;
import com.shop.common.model.result.user.UserPayOutput;
import com.shop.common.tmpl.BaseController;
import com.shop.user.atom.IUserAtomApi;
import com.shop.user.atom.atomsvc.IMessageAtomSvc;
import com.shop.user.atom.atomsvc.IUserAtomSvc;
import com.shop.user.atom.atomsvc.IUserPayAtomSvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 *
 * @author zhoulk
 * @date: 2019年04月08日  0:25
 */
@RestController
public class UserAtomController extends BaseController implements IUserAtomApi {

    @Autowired
    IUserAtomSvc iUserAtomSvc;
    @Autowired
    IUserPayAtomSvc iUserPayAtomSvc;
    @Autowired
    IMessageAtomSvc iMessageAtomSvc;

    @Override
    public UserBase qryUserBaseByUserId(@PathVariable(value = "userId") Integer id) {
        return iUserAtomSvc.selectBaseUserById(id);
    }

    @Override
    public UserPayOutput qryUserPayByUserId(@PathVariable(value = "userId") Integer id) {
        return iUserPayAtomSvc.selectUserPay(id).getData();
    }

    @Override
    public ServiceBean<String> modUserPay(@RequestBody UserPayInput userPayInput) {
        return iUserPayAtomSvc.updateUserPay(userPayInput);
    }

    @Override
    public ServiceBean<Integer> addUserPayLog(@RequestBody UserPayLogInput userPayLogInput) {
        return iUserPayAtomSvc.addUserPayLog(userPayLogInput);
    }

    @Override
    public Integer sendMsg(@RequestBody MessageInput messageInput) {

        return iMessageAtomSvc.addMessage(messageInput);
    }
}
